// Kylin AIOps 前端配置总结
// 创建日期: 2025-08-15

const config = {
  // 环境配置
  environment: {
    // 基础环境配置
    base: {
      api_url: 'http://192.168.1.5:5000/api',
      base_url: 'http://192.168.1.5:5000',
      grafana_url: 'http://192.168.1.5:3000',
      api_mocking_enabled: false,
    },

    // 开发环境配置
    development: {
      api_url: 'http://192.168.1.5:5000/api',
      api_mocking_enabled: false,
      grafana_url: 'http://192.168.1.5:3000',
    },

    // 模拟环境配置
    mocking: {
      api_url: 'http://192.168.1.5:5000/api',
      api_mocking_enabled: true,
      grafana_url: 'http://192.168.1.5:3000',
    },
  },

  // Vite 构建配置
  vite: {
    server: {
      port: 7000,
      host: true,
      hmr: {
        host: '0.0.0.0',
      },
    },
    build: {
      chunk_size_warning_limit: 1600,
    },
    css: {
      preprocessor: 'scss',
    },
    plugins: [
      'vue-macros',
      'pages',
      'layouts',
      'auto-import',
      'components',
      'unocss',
      'vue-i18n',
    ],
  },

  // UnoCSS 配置
  unocss: {
    presets: [
      'uno',
      'attributify',
      'icons',
      'typography',
      'wind',
      'web-fonts',
    ],
    transformers: [
      'directives',
      'variant-group',
    ],
  },

  // 国际化配置
  i18n: {
    default_locale: 'cn',
    available_locales: ['cn', 'en'],
  },

  // Pinia 状态管理
  pinia: {
    plugins: ['persistedstate'],
  },

  // API 服务配置
  api: {
    base_url: process.env.VITE_API_URL,
    headers: {
      content_type: 'application/json',
      authorization: 'Bearer token',
    },
    interceptors: {
      request: true,
      response: true,
    },
    error_handling: {
      notification: true,
    },
  },

  // Mock 服务配置
  mock: {
    enabled: process.env.VITE_API_MOCKING_ENABLED === 'true',
    service_worker: {
      url: '/mockServiceWorker.js',
      scope: '/',
    },
    options: {
      quiet: true,
      wait_until_ready: false,
    },
  },

  // 路由配置
  router: {
    history_mode: 'web',
    layouts_enabled: true,
    title_template: '${page_title} - ${app_title}',
  },

  // 依赖库版本
  dependencies: {
    vue: '^3.5.17',
    vue_router: '^4.5.1',
    pinia: '^3.0.3',
    axios: '^0.27.2',
    naive_ui: '^2.42.0',
    vite: 'latest',
    unocss: '^66.3.2',
    vue_i18n: '^9.14.4',
    socket_io_client: '^4.8.1',
    xterm: '^5.3.0',
  },

  // 构建脚本
  scripts: {
    build: 'vite build --base=/ --mode mocking',
    dev: 'vite --open --port 7000 --mode development',
    dev_mock: 'vite --open --port 7000 --mode mocking',
    test: 'vitest',
    test_unit: 'vitest',
    typecheck: 'vue-tsc --noEmit',
  },

  // 项目结构
  structure: {
    assets: '静态资源文件',
    common: '通用工具和API',
    components: '可复用组件',
    composables: '组合式API',
    layouts: '页面布局',
    mocks: '模拟数据',
    models: '数据模型',
    modules: '应用模块',
    pages: '页面组件',
    services: '服务层',
    store: '状态管理',
    styles: '样式文件',
  },
  // 终端连接配置
  terminal: {
    host: '192.168.1.5',
    username: 'root',
    password: 'Huawei@678'
  },
  // Socket.IO 连接配置
  socket: {
    host: '192.168.1.5',
    port: 5000
  },

  // 异常检测配置
  detection: {
    api_url: 'http://192.168.1.5:5000/api',
    data_url: 'http://192.168.1.5:5000/detection-data'
  },
  // 缺陷识别配置
  defect_identification: {
    base_url: 'http://192.168.1.5:5000/api/detection'
  },
  // 根因分析配置
  root_cause_analysis: {
    api_url: 'http://192.168.1.5:5000/api',
    data_url: 'http://192.168.1.5:5000/rootheal-data'
  }
  




};

export default config;
